﻿#include<stdio.h>
#include<vector>
#include <iostream>
#include <map>
using namespace std; 
vector <int>a;
class Solution {
public:
    vector <int> twoSum(vector<int>& nums, int target) {
        map<int, int>hm;
        vector <int>ans;
        for (int i = 0; i < nums.size(); i++)
        {
            hm[nums[i]] = i;
        }
        for (int i = 0; i < nums.size(); i++)
        {
            if (hm.find(target - nums[i]) != hm.end()&& hm[target - nums[i]]!=i)
            {
                ans.push_back(i);
                ans.push_back(hm[target - nums[i]]);
                return ans;
            }
        }
        return ans;
    }
};
int main()
{
    int arr[] = { 3,2,4 };
    vector<int> vec(arr, arr + 3);
    int target = 6;
    Solution s;
    cout << s.twoSum(vec, 6)[0]<<" "<< s.twoSum(vec, 6)[1]<<endl;
}

